<!--
 * @Author: hucc
 * @Date: 2021-10-15 15:08:17
 * @LastEditors: hucc
 * @LastEditTime: 2021-10-15 15:21:15
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/axios.js"></script>
    <script src="../js/qs.js"></script>
    <script>
        const qs = Qs;
        const baseUrl = "http://39.103.202.53:8888"
        const queryData = {
            page: 1,
            pageSize: 10
        }
        const loginData = {
            username: 'admin1',
            password: 123321
        }
        const applyData = {
            name: 'tom',
            age: 12,
            telephone: 1236668888,
            gender: 'male'
        }
        axios({
                baseURL: "http://39.103.202.53:8888",
                url: '/user/login',
                method: 'post',
                // headers: {
                //     'Content-type': 'application/x-www-form-urlencoded'
                // },
                data: loginData
            }).then(res => {
                console.log(res)
            }).catch(err => {
                console.log(err);
            })
            //axios 默认把数据转为json格式   Content-type默认是'application/json'
            //表单数据用查询字符串转码
        axios({
            baseURL: "http://39.103.202.53:8888",
            url: '/user/login',
            method: 'post',
            headers: {
                'Content-type': 'application/x-www-form-urlencoded'
            },
            data: qs.stringify(loginData)
        })
        axios({
            baseURL: "http://39.103.202.53:8888",
            url: '/user/login',
            method: 'get',
            //get 传参不需要配置 Content-type
            // headers: {
            //     'Content-type': 'application/x-www-form-urlencoded'
            // },
            //get地址栏传参放在params中
            params: {
                page: 1,
                pageSize: 10
            }
        })
    </script>
</head>

<body>

</body>

</html>